// Decompiled by GOOSIN CO,LTD Copyright 2010 Pavel Kouznetsov.
// home page: http://www.Goosin.net
// Decompiler options: packimports(3) fieldsfirst ansi space 
// Source File Name:   register_module_ok.java

package security.license;

import include.nseer_cookie.*;
import include.nseer_db.nseer_db_backup1;
import include.tree_index.Nseer;
import java.io.IOException;
import javax.servlet.ServletException;
import javax.servlet.http.*;
import javax.servlet.jsp.JspFactory;

public class register_module_ok extends HttpServlet
{

	public register_module_ok()
	{
	}

	public synchronized void service(HttpServletRequest request, HttpServletResponse response)
		throws IOException, ServletException
	{
		HttpSession dbSession = request.getSession();
		JspFactory _jspxFactory = JspFactory.getDefaultFactory();
		javax.servlet.jsp.PageContext pageContext = _jspxFactory.getPageContext(this, request, response, "", true, 8192, true);
		javax.servlet.ServletContext dbApplication = dbSession.getServletContext();
		HttpSession session = request.getSession();
		try
		{
			nseer_db_backup1 db = new nseer_db_backup1(dbApplication);
			Nseer n = new Nseer();
			InsMod im = new InsMod();
			String human_name = request.getParameter("human_name");
			String human_ID = request.getParameter("human_ID");
			String choose_value_group = request.getParameter("choose_value_group");
			String dbase = request.getParameter("dbase");
			String module = request.getParameter("module");
			session.setAttribute("module", module);
			String file_id[] = request.getParameterValues("file_id");
			if (file_id == null)
				response.sendRedirect((new StringBuilder("security/license/register_module_ok_a.jsp?human_ID=")).append(human_ID).append("&&human_name=").append(toUtf8String.utf8String(exchange.toURL(human_name))).append("&&choose_value_group=").append(toUtf8String.utf8String(exchange.toURL(choose_value_group))).toString());
			else
			if (db.conn((String)dbSession.getAttribute("unit_db_name")))
			{
				db.executeUpdate((new StringBuilder("delete from ")).append(dbase).append("_view where module_name!='all' and human_ID='").append(human_ID).append("'").toString());
				for (int i = 0; i < file_id.length; i++)
				{
					im.insert(dbase, human_ID, human_name, file_id[i], db);
					im.insertw(dbase, module, human_ID, db);
				}

				db.commit();
				db.close();
				choose_value_group = (new StringBuilder(String.valueOf(choose_value_group))).append(dbase).append(",").toString();
				response.sendRedirect((new StringBuilder("security/license/register_module_ok_b.jsp?human_ID=")).append(human_ID).append("&&human_name=").append(toUtf8String.utf8String(exchange.toURL(human_name))).append("&&choose_value_group=").append(toUtf8String.utf8String(exchange.toURL(choose_value_group))).toString());
			} else
			{
				response.sendRedirect("error_conn.htm");
			}
		}
		catch (Exception ex)
		{
			ex.printStackTrace();
		}
	}
}
